<template>
  <div>
    <h2>首页</h2>
    <button @click="decounter">-</button>
    {{$store.state.counter}}
     <button @click="addcounter">+</button>
     <button @click="addCount(5)">+5</button>
    <br/>
     {{$store.getters.newcouter}}
     <br/>
     modulea中的{{$store.state.a.name}}
  </div>
</template>

<script>
export default {
  name:'homepage',
  methods:{
    decounter(){
      this.$store.commit('decrement');
    },
    addcounter(){
      //this.$store.commit('increment');
      this.$store.dispatch('aincrement')
    }
    ,
    addCount(count){
     // this.$store.commit('addCount',count);
     this.$store.dispatch('aaddCount','传入的message').then(res=>{
       console.log(res)
     })
    }
  }
}
</script>

<style lang="stylus" scoped>

</style>